package com.fun.crius.tvs.controller;

import com.fun.crius.tvs.service.TestService;
import com.google.common.collect.ImmutableMap;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class TestController {

    @Autowired
    private TestService testService;

    @Value("${server.port}")
    private String port;

    @GetMapping("/cflow")
    public String cflow(String version, String ip) {
        testService.doSomething(version, ip);
        return new Gson().toJson(ImmutableMap.of("success", "200", "source", port));
    }
}
